package com.csnf.controller;

import com.csnf.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/seataOrder")
public class OrderController {

    @Autowired
    OrderService orderService;

    @RequestMapping("/addOrder")
    public String addOrder(String userId,String productCode,int count){
        int r = orderService.addOrder(userId, productCode, count);
        if (r > 0){
            return "库存扣减成功";
        }else {
            return "库存扣减失败";
        }
    }
}
